<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            height: 100px;

            color: aliceblue;
            background-color: pink;
        }

        .change {
            width: 200px;
            height: 200px;
            color: black;
            background-color: #fff;
        }
    </style>
</head>
<body>
    <div class="box">文本</div>
    <script>
        var box = document.querySelector('div');
        box.onclick = function() {
            this.className = 'change';
        }
    </script>
</body>
</html>